package org.frog.sgs.mina.server;

import java.nio.charset.Charset;

import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolDecoderOutput;

/**
 * @author duanxiangqi
 * @date 2012-10-18
 */
public class MyProtocolDecoder implements ProtocolDecoder {

	Charset charset = Charset.forName("UTF-8");

	IoBuffer buf = IoBuffer.allocate(100).setAutoExpand(true);

	public void decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception {
		while (in.hasRemaining()) {
			System.out.println(in.getInt());
		}
	}

	public void dispose(IoSession session) throws Exception {

	}

	public void finishDecode(IoSession session, ProtocolDecoderOutput out) throws Exception {

	}
}
